<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body></body>
</html>
<script>
    const str = `
        url("./assets/1.jpg");
        url("../../assets/2.jpg");
        url("../../../assets/3.jpg");
    `;
    const regx = /(?<=url\()([\s\S]+?)(?=\))/gi;
    const res = str.replace(regx, (item, ...rest) => {
        console.log(item);
        return item.replace(/(\.\.\/)+/g, "");
    });
</script>
